package com.tedu;

import java.io.*;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws IOException {
        System.out.println("输入要读取的正确的文件名：");
        String sc = new Scanner(System.in).nextLine();
        InputStream is =new FileInputStream(sc);
        System.out.println("输入正确的字符编码：");
        String sc1 = new Scanner(System.in).nextLine();
        InputStreamReader isr = new InputStreamReader(is,sc1);
        BufferedReader br = new BufferedReader(isr);
        FileOutputStream fs = new FileOutputStream("note_utf.txt");
        OutputStreamWriter ow = new OutputStreamWriter(fs,sc1);
        String x = null;
        while ((x=br.readLine())!=null){
            System.out.println(x);
            ow.write(x);
        }
        is.close();
        ow.close();
    }
}
